package com.dm0858.bianmin.ui.presenter;

import com.dm0858.bianmin.model.response.BannerResponse;
import com.dm0858.bianmin.ui.base.BasePresenter;
import com.dm0858.bianmin.view.IBannerListView;
import com.socks.library.KLog;

import rx.Subscriber;

/**
 * Created by yelvqing on 2017/11/13.
 */

public class BannerListPresenter extends  BasePresenter<IBannerListView> {
    public BannerListPresenter(IBannerListView view) {
        super(view);
    }

    public void getBanner() {
        addSubscription(mApiService.getBanner(), new Subscriber<BannerResponse>() {
            @Override
            public void onCompleted() {

            }

            @Override
            public void onError(Throwable e) {

                e.printStackTrace();
                KLog.e(e.getLocalizedMessage());
               mView.onError();
            }

            @Override
            public void onNext(BannerResponse response) {

               mView.onGetBannerListSuccess(response);
            }

        });
    }

}
